package com.bridgeintelligent.tag.webserver.dim.mgmt.service.dimproperty;

import com.bridgeintelligent.tag.webserver.dim.mgmt.api.DimRep;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotBlank;

/**
 * Created by JackCheung on 2019/9/15 12:27 PM.
 */
@Api(tags = "标签属性列表")
@RestController
@RequestMapping("/api/dimProperty")
@Validated
public class DimPropertyController {

    private IDimPropertyService iDimPropertyService;

    public DimPropertyController(IDimPropertyService iDimPropertyService) {
        this.iDimPropertyService = iDimPropertyService;
    }

    @ApiOperation(value = "标签分类列表", notes = "标签属性列表")
    @GetMapping("classify")
    public DimRep classify() {
        return iDimPropertyService.dimClassify();
    }

    @ApiOperation(value = "标签数据来源列表", notes = "标签属性列表")
    @GetMapping("dataSource")
    public DimRep dataSource() {
        return iDimPropertyService.dimDataSource();
    }

    @ApiOperation(value = "标签展示规则", notes = "标签属性列表")
    @GetMapping("showType")
    public DimRep showType() {
        return iDimPropertyService.dimShowType();
    }


    @ApiOperation(value = "标签字典", notes = "字典项列表")
    @GetMapping("dict/{type}")
    public DimRep dict(@PathVariable @NotBlank String type) {
        return iDimPropertyService.dict(type);
    }
}
